<?php
/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2018-01-05 16:09:09
 * @version $Id$
 */
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
    
    public function _initialize(){
    	$this->checkAdminSession();
    	$this->configcache();
    }

    /*
	 * 判断用户是否登陆方法
	 *
     */
    public function checkAdminSession(){
    	$nowTime=time();
        $endTime=C('USER_AUTH_SESSION');//读取配置文件中的session过期时间

        if(!isset($_SESSION['ThinkUser'])){
            R('Public/location',array('抱歉！您还没有登陆',__APP__.'/Index/index'));
        }
    	
    }
    //基本配置信息缓存
    public function configcache() {
        if (!S('configcache')) {
            $configcache = require(CONF_PATH.'webconfig.php');
            S('configcache', $configcache, $configcache['DataCache']*3600);
        }
        $this->assign('configcache',S('configcache'));
    }
}